Skip to content

Improve UI test cases#61

Merged
yasserahmed10 merged 27 commits intodevelopmentfrom
improve-ui-test-cases
May 19, 2025
Merged

Improve UI test cases#61
yasserahmed10 merged 27 commits intodevelopmentfrom
improve-ui-test-cases

Conversation

@yasserahmed10
Copy link
Contributor

This pull request introduces comprehensive improvements to the test coverage of the UI components for authentication and project management. It replaces mocked annotations with mockk objects, adds new test cases for various scenarios, and ensures better handling of user roles and session states.

Authentication Test Enhancements:

  • LoginUserUITest: Added new test cases to validate successful login, retry logic after failure, and handling of multiple login failures before success. These tests ensure robust behavior for different login scenarios.
  • RegisterAdminUITest: Refactored to use mockk for ConsoleIO, added detailed test cases for successful registration, retry logic after failure, and handling multiple registration failures. Enhanced password validation and error handling.

Project Management Test Enhancements:

  • CreateProjectUITest: Replaced MockKAnnotations with mockk objects, added test cases for admin and non-admin users, error handling during project creation, and state addition flow. Improved session management handling via SessionManager.
  • GetAllProjectsUITest: Added session-based role handling to differentiate behavior for admin and non-admin users. Introduced test cases to verify project display logic and improved mock setup for project data. [1] [2]

These changes enhance the reliability and maintainability of the test suite by ensuring comprehensive coverage of edge cases and user role-specific behaviors.

@yasserahmed10 yasserahmed10 self-assigned this May 19, 2025
@yasserahmed10 yasserahmed10 added enhancement New feature or request test cases Work on Testcases labels May 19, 2025
@github-actions
Copy link

Test Results

502 tests  +125   479 ✅ +131   17s ⏱️ +7s
 90 suites + 21     0 💤 ±  0 
 90 files   + 21    23 ❌  -   6 

For more details on these failures, see this check.

Results for commit b40ebb8. ± Comparison against base commit f63df46.

This pull request removes 20 and adds 144 tests. Note that renamed tests count towards both.

domain.usecases.project.UpdateProjectUseCaseTest ‑ [4] 
presentation.project.CreateProjectUITest ‑ invoke should create project successfully for admin user()
presentation.project.CreateProjectUITest ‑ invoke should create project successfully for regular user()
presentation.project.CreateProjectUITest ‑ invoke should handle error when creating project fails()
presentation.project.CreateProjectUITest ‑ invoke should handle null user in SessionManager()
presentation.project.GetAllProjectsUITest ‑ should display error message when exception is thrown()
presentation.project.GetAllProjectsUITest ‑ should display projects when projects are available()
presentation.project.ProjectsUITest ‑ should call createProjectUI when option 1 is selected()
presentation.project.ProjectsUITest ‑ should call deleteProjectUI when option 3 is selected()
…
domain.usecases.project.UpdateProjectUseCaseTest ‑ [4] 

presentation.auth.LoginUserUITest ‑ should handle multiple login failures before success()
presentation.auth.LoginUserUITest ‑ should login successfully on first attempt()
presentation.auth.LoginUserUITest ‑ should retry login after failure and then succeed()
presentation.project.CreateProjectUITest ‑ should create project successfully when user is admin()
presentation.project.CreateProjectUITest ‑ should create project successfully when user is not admin()
presentation.project.CreateProjectUITest ‑ should create task state when user selects yes()
presentation.project.CreateProjectUITest ‑ should handle exception when creating project()
presentation.project.CreateProjectUITest ‑ should handle null user in session()
presentation.project.GetAllProjectsUITest ‑ should display projects when user is admin()
…

@github-actions
Copy link

❌ Test or Coverage checks failed! Please check the workflow run for details.

Copy link
Contributor

@AimanYosofiUlt AimanYosofiUlt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job bro 👍

@yasserahmed10 yasserahmed10 merged commit 876c78a into development May 19, 2025
1 of 5 checks passed
@yasserahmed10 yasserahmed10 deleted the improve-ui-test-cases branch May 19, 2025 18:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request test cases Work on Testcases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants